<template>
  <v-layout type="main">
    <div class="alick-handle">
    </div>
    <el-table :data="tableData">
        <el-table-column prop="organization.name" label="机构名称" />
        <el-table-column prop="gpu_num" label="GPU配额(单位:卡)"></el-table-column>        
        <el-table-column prop="cpu_num" label="CPU配额(单位:毫核)"></el-table-column>             
        <el-table-column prop="mem_num" label="内存配额(单位:MB)"></el-table-column>      
        <el-table-column prop="rdma_num" label="网络RDMA配额(单位:卡)"></el-table-column>      
        <el-table-column prop="update_time" label="修改时间" />
        <el-table-column prop="op" label="操作">
          <template slot-scope="{ row }">
            <el-button type="text" @click="put(row.id)">修改</el-button>
          </template>
        </el-table-column>
    </el-table>
    <div class="pagination-box" v-if="Pagedata.total > Pagedata.size">
      <el-pagination
        background
        class="pagination"
        layout="total, prev, pager, next, jumper"
        :page-size="Pagedata.size"
        :current-page.sync="Pagedata.current"
        @current-change="handleCurrentChange"
        :total="Pagedata.total">
      </el-pagination>
    </div>
    
  </v-layout>
</template>

<script>
import { organizationConfigurationLis } from '@/api/org'

export default {
  data () {
    return {
      tableData: [],
      Pagedata: {
        current: 1,
        size: 10,
        total: 0,
      },
    };
  },
  async created () {
    this.getData()
  },
  methods: {
    async getData() {
      let res = await organizationConfigurationLis({ ...this.Pagedata })
      this.tableData = res.data.list
      this.Pagedata.total = res.total
    },
    put(id) {
      this.$router.push({
        path: '/orgConfig/detail',
        query: { id }
      })
    },
    formatterAdmin(row) {
      let admin = row.adminList.map(e => e.nickName)
      return admin.join('<br />')
    },
    handleCurrentChange(val) {
      this.Pagedata.current = val
      this.getData()
    },
  }
}
</script>
<style lang="less" scoped>

</style>